
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>nginx和zuul(gateway)网关的区别 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>nginx和zuul(gateway)网关的区别 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Nginx的核心设计目标是什么？它主要侧重于哪一网络层面的功能？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Nginx最初的设计目标是作为高性能的HTTP服务器、反向代理服务器和负载均衡器。它主要侧重于网络层的功能，例如处理静态资源托管、反向代理和负载均衡任务。</div>
          </div>
          <div class="card-source">来源: 1. 设计目标与用途</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Zuul / Spring Cloud Gateway 在微服务架构中扮演什么角色？它们专注于哪些应用层功能？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Zuul / Spring Cloud Gateway 在微服务架构中作为API网关，专注于应用层的功能，例如认证授权、限流、熔断、动态路由和日志记录等。</div>
          </div>
          <div class="card-source">来源: 1. 设计目标与用途</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Nginx 和 Spring Cloud Gateway 在底层技术栈上有何本质区别？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Nginx 是用 C 语言编写的，性能极高。而 Spring Cloud Gateway 是基于 Spring WebFlux 和 Reactive Streams 构建的，采用 Java 编写，具有非阻塞和响应式的特性。</div>
          </div>
          <div class="card-source">来源: 2. 技术栈</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在路由和过滤功能上，Zuul/Spring Cloud Gateway 相较于 Nginx 有什么核心优势？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Zuul/Spring Cloud Gateway 的核心优势在于天生支持动态路由和强大的过滤器。它们可以根据请求内容动态选择目标服务，并能在请求到达微服务前后进行加工处理，如鉴权、日志和限流，这比 Nginx 通过 Lua 脚本或第三方模块扩展更为灵活。</div>
          </div>
          <div class="card-source">来源: 3. 路由和过滤功能</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">从性能角度看，Nginx 相对于 Spring Cloud Gateway 的主要优势是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Nginx 的主要性能优势在于其采用C语言编写和事件驱动模型，性能非常高，尤其擅长处理静态内容和高并发请求。相比之下，Java编写的Spring Cloud Gateway在性能上会略逊一筹。</div>
          </div>
          <div class="card-source">来源: 4. 性能与扩展性</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">在微服务架构中，Nginx 和 Spring Cloud Gateway 通常如何协同工作？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它们可以搭配使用，形成一种常见模式：Nginx 作为外层的反向代理或前置代理，负责处理大量静态内容和简单的请求转发；然后将请求转发到内部的 Spring Cloud Gateway，由后者处理认证、动态路由等复杂的应用层逻辑。</div>
          </div>
          <div class="card-source">来源: 6. 使用场景</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
